package com.vanke.devops.domain.enums;

import com.vanke.core.exception.VankeBusinessException;

/**
 * @author 陈景阳
 * @since 2018/5/11
 */
public enum  CaptchaErrorCode implements ErrorCode{
    RESEND_SMS_CODE("B20020", "短信验证码未获取或已过期，请重新获取验证码"),
    CAPTCHA_EXPIRED("B20018", "图形验证码失效，请刷新图形验证码"),
    SMS_CODE_ERROR("B20020", "短信验证码不正确"),
    CAPTCHA_IS_INCORRECT("B20017", "图形验证码错误"),
    CAPTCHA_TYPE_INCORRECT("B20015", "验证码类型错误"),
    ;

    private String code;
    private String message;

    CaptchaErrorCode(String code, String message) {
        this.code = code;
        this.message = message;
    }

    @Override
    public String getCode() {
        return ErrorCode.getErrorCodePrefix(CaptchaErrorCode.class) + code;
    }
    @Override
    public String getMessage() {
        return message;
    }

    public VankeBusinessException getException(){
        return new VankeBusinessException(this.getCode(), this.getMessage());
    }
}
